'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    const { INTEGER, STRING, DATE } = Sequelize;
    await queryInterface.createTable('sys_dict_data', {
      dict_code:{
        type: INTEGER(20),
        comment: "字典编码",
        allowNull:false,
        primaryKey: true,
        autoIncrement: true
      },
      dict_sort:{
        type:INTEGER(4),
        comment:"字典排序",
        defaultValue:0
      },
      dict_label:{
        type:STRING(100),
        comment:"字典标签",
        defaultValue:""
      },
      dict_value:{
        type:STRING(100),
        comment:"字典键值",
        defaultValue:""
      },
      dict_type:{
        type:STRING(100),
        comment:"字典类型",
        defaultValue:""
      },
      css_class:{
        type:STRING(200),
        comment:"样式属性（其他样式扩展）",
        defaultValue:""
      },
      list_class:{
        type:STRING(100),
        comment:"表格回显样式",
        defaultValue:""
      },
      is_default:{
        type:STRING(1),
        comment:"是否默认（Y是 N否）",
        defaultValue:"N"
      },
      status:{
        type:STRING(1),
        comment:"状态（0正常 1停用）",
        defaultValue:"0"
      },
      create_by:{
        type:STRING(64),
        comment:"创建者",
        defaultStatus:""
      },
      update_by:{
        type:STRING(64),
        comment:"更新者",
        defaultValue:""
      },
      remark:{
        type:STRING(500),
        comment:"备注",
        defaultValue:""
      },
      created_at: {
        type: DATE,
        comment: "创建时间",
      },
      updated_at: {
        type: DATE,
        comment: "更新时间",
      },
      deleted_at: {
        type: DATE,
        comment: "删除时间",
      }
    });
  },

  down: async (queryInterface, Sequelize) => {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
     await queryInterface.dropTable('sys_dict_data');
  }
};
